

from urllib.request import urlopen
from bs4 import BeautifulSoup

html = urlopen("http://www.jb51.net/article/43572.htm")
#解析HTML代码为BeautifulSoup对象
bsObj = BeautifulSoup(html)
namelist = bsObj.findAll("div",{"class":"one"})
f = open('green.txt','w')
for name in namelist:
    f.write(name.get_text())
f.close()